[#macro passwordShowView]
<div>
    <el-row>
        <el-col :span="16">
            <el-form ref="ruleForm" label-width="120px" :model="form" :rules="rules">
                <el-form-item label="老密码" prop="oldPassword" key="oldPasswordItem">
                    <el-input v-model="form.oldPassword" size="small"></el-input>
                </el-form-item>
                <el-form-item label="新密码" prop="password" key="password">
                    <el-input v-model="form.password" size="small"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="updatePassword" size="small">修改密码
                    </el-button>
                </el-form-item>
            </el-form>
        </el-col>
    </el-row>

</div>
[/#macro]
[#macro passwordShowConfig]
<script type="text/x-template" id="my-password-show">
    [@passwordShowView /]
</script>
<script type="text/javascript">
    //显示组件开始
    var passwordShowConfig = {};
    passwordShowConfig.template = "#my-password-show";
    passwordShowConfig.methods = config.basicMethod();
    passwordShowConfig.data = function () {
        return {
            form: {
                oldPassword: '',
                password: ''
            },
            rules: {
                oldPassword: [
                    { required: true, message: '请输入老密码', trigger: 'blur' }
                ],
                password: [
                    { required: true, message: '请输入新密码', trigger: 'blur' }
                ],
            }
        }
    };


    passwordShowConfig.methods.updatePassword = function (event) {
        var self = this;
        this.$refs["ruleForm"].validate((valid) => {
            if (valid) {

                var data = self.form;
                self.postData("${siteurl}admin/member/updatepassword.htm", data, function (res) {
                    if (res.code != 0) {
                        self.$message.error(res.msg);
                    } else {
                        self.$message({
                            message: '更新密码成功',
                            type: 'success'
                        });
                    }
                })
            } else {
                console.log('error submit!!');
                return false;
            }
        });
    }

    var passwordShowView = Vue.component('my-password-view', passwordShowConfig);
		//显示组件结束
</script>
[/#macro]